package com.isunland.managesystem.adapter;

import android.support.annotation.NonNull;
import android.view.View;
import android.widget.TextView;
import butterknife.BindView;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BaseButterKnifeAdapter;
import com.isunland.managesystem.base.BaseVolleyActivity;
import com.isunland.managesystem.entity.BookOrderInfo;
import com.isunland.managesystem.utils.MyDateUtil;
import com.isunland.managesystem.utils.MyUtils;
import java.util.ArrayList;

public class AppointementOrderAdapter extends BaseButterKnifeAdapter<BookOrderInfo> {

  public AppointementOrderAdapter(BaseVolleyActivity context, ArrayList<BookOrderInfo> objects) {
    super(context, objects);
  }

  @Override protected int setLayoutId() {
    return R.layout.adapter_appointment_order;
  }

  @Override protected void initView(BookOrderInfo item, BaseViewHolder baseHolder, int position) {

    ViewHolder holder = (ViewHolder) baseHolder;
    holder.tvOrderNo.setText(context.getString(R.string.orderNoWithHoder, item.getBookNo()));
    holder.tvOperationDesc.setText(item.getBookWordDesc());

    //noinspection deprecation
    holder.tvOrderTime.setText(
        MyDateUtil.parseDateToString(MyDateUtil.parseStringToDate(item.getBookWorkDate())));

    MyUtils.switchShadowStutus(context, holder.tvPlanStatus, item.getDataStatus(),
        item.getDataStatusName());//数据状态
  }

  @NonNull @Override
  protected BaseButterKnifeAdapter<BookOrderInfo>.BaseViewHolder initHolder(View convertView) {
    return new ViewHolder(convertView);
  }

  protected class ViewHolder extends BaseViewHolder {
    @BindView(R.id.tv_orderNo) TextView tvOrderNo;
    @BindView(R.id.tv_operationDesc) TextView tvOperationDesc;
    @BindView(R.id.tv_bottomLeft) TextView tvOrderTime;
    @BindView(R.id.tv_planStatus) TextView tvPlanStatus;
    //@BindView(R.id.tv_bottomRight)
    //TextView tvMoney;
    //@BindView(R.id.tv_cancel)
    //TextView tvCancel;
    //@BindView(R.id.tv_reminder)
    //TextView tvReminder;

    ViewHolder(View view) {
      super(view);
    }
  }
}
